<!-- 
 * 自定义tabs
 * @author: 
 * @since: 2022-06-30
 * index.vue
-->
<template>
  <div class="custom-tabs-container">
    <el-button type="primary" @click="tabsClick(index)" size="mini" v-for="(item, index) in list" :key="index" :class="{ isClick: state.tabsActive === index }">{{ item }}</el-button>
  </div>
</template>

<script setup>
import { reactive, defineProps, defineEmits } from 'vue'

const props = defineProps({
  list: {
    type: Array,
    default: () => []
  }
})

const state = reactive({
  tabsActive: 0

})

const emit = defineEmits(['currentClick'])


const tabsClick = (index) => {
  emit('currentClick', index);
  state.tabsActive = index
}


</script>

<style lang="scss" scoped>
.custom-tabs-container {
  padding: 20px 20px 0 20px;
  .el-button {
    color: #00a2ff;
    background: #fff;
    border: 1px solid #e3e3e3;
    transition: all, 0.3s;
    margin: 0 10px 0 0;
  }
  .isClick {
    color: #fff;
    background: #00a2ff;
    border: 1px solid #00a2ff;
  }
}
</style>
